let pageParams = (ctx, tools) => {
    let whichPage = ctx.request.body.whichPage
    let user = ctx.user
    let cs = {
        customerbills: {
            fileName: '往来对账单',
            allowPage: false,
            columns: [
                {type: 'seq', width: 50},
                {field: 'name', title: '部门名称', width: 150,treeNode: true, op: " ='%$%' ",excel: true},
                {field: 'manName', title: '负责人', width: 80, op: " like '%$%' ",excel: true},
                {field: 'phone', title: '部门电话', width: 80, op: " like '%$%' ",excel: true},
            ],
            sql: `select * from (
                    select a.*,b.name manName from dept a left join admin b on a.manId=b.id 
                    where a.tenantId=${user.tenantId} and a.isDel=0
                  ) a where 1=1  `,
            order: ' order by id desc ',
            form: {
                rule: [
                    {field: 'name', title: '部门名称', effect: {required: true} },
                    {field: 'manName', title: '负责人',  },
                    {field: 'phone', title: '部门电话',  },
                ]
            }
        },
        车辆: {
            fileName: '车辆',
            allowPage: false,
            sql: `
                select id,licence,name,
                       case when isnull(length,0)=0 then null else length end length,
                       case when isnull(width,0)=0 then null else width end width,
                       case when isnull(height,0)=0 then null else height end height,
                       case when isnull(load,0)=0 then null else load end load
                from cars where tenantId=$tid and isDel=0 
            `,
            order: '  order by name ',
            columns: [
                {type: 'seq', width: 50},
                // {field: 'invName', title: '商品名称', width: 300, excel: true,sortable: true,filter: true},
                // {field: 'locationName', title: '仓库名称', width: 130, excel: true,sortable: true,filter: true,align: 'center'},
                // {field: 'spec', title: '规格', width: 60, excel: true,align: 'center'},
                {field: 'transTypeName', title: '业务类型', width: 80, excel: true,align: 'center'},
                {field: 'billDate', title: '日期', width: 100, excel: true,align: 'center'},
                {field: 'buName', title: '往来单位', width: 220, excel: true,align: 'left'},
                {title: '库存新增', align: 'center',
                    children:[
                        {field: 'inC', title: '数量', width: 80,excel: true, headerAlign: 'center',align: 'right',sum: true},
                        {field: 'inP', title: '单价', width: 80,excel: true, headerAlign: 'center',align: 'right', },
                        {field: 'inM', title: '金额', width: 100,excel: true, headerAlign: 'center',align: 'right',sum: true},
                    ]
                },
                {title: '库存减少（成本）', align: 'center',
                    children:[
                        {field: 'outC', title: '数量', width: 80,excel: true, headerAlign: 'center',align: 'right',sum: true},
                        {field: 'outP', title: '成本单价', width: 80,excel: true, headerAlign: 'center',align: 'right', },
                        {field: 'outM', title: '金额', width: 100,excel: true, headerAlign: 'center',align: 'right',sum: true},
                    ]
                },
                {title: '期末结存（成本）', align: 'center',
                    children:[
                        {field: 'lastC', title: '数量', width: 80,excel: true, headerAlign: 'center',align: 'right' ,sumIsLast: true},
                        {field: 'lastP', title: '单价', width: 80,excel: true, headerAlign: 'center',align: 'right', },
                        {field: 'lastM', title: '金额', width: 100,excel: true, headerAlign: 'center',align: 'right' ,sumIsLast: true},
                    ]
                },
            ],
            search: {
                rule: [
                    {field: 'range', title: '日期', width: 150, op: " ='$' ",type: 'JPicker', props: {clearable: true, type: 'daterange',width: 220},},
                    {field: 'beginDate', op:" >= '$'", hide: true},
                    {field: 'endDate', op:" <= '$'",  hide: true},
                    {field: 'locationId', op:" = '$'",  hide: true},
                    {field: 'invId', op:" = '$'",  hide: true},
                ]
            },
            form: {
                mod: 'initGoods',
                rule: []
            }
        },
    }
    return cs[whichPage]
}


module.exports = pageParams